package com.onesports.intelligent.k12.polarlight.mapper.organization;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.onesports.intelligent.k12.polarlight.annotation.DataPermission;
import com.onesports.intelligent.k12.polarlight.domain.dto.operation.PageOperationCoachDTO;
import com.onesports.intelligent.k12.polarlight.domain.dto.organization.PageOrganizationCoachDTO;
import com.onesports.intelligent.k12.polarlight.domain.entity.organization.Coach;
import com.onesports.intelligent.k12.polarlight.domain.entity.sys.WxUser;
import com.onesports.intelligent.k12.polarlight.domain.vo.operation.PageOperationCoachVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.organization.CoachServeVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.organization.PageOrganizationCoachVO;
import com.onesports.intelligent.k12.polarlight.enums.DataPermissionTypeEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 教练
 *
 * @author
 * @since 1.0.0 2022-07-08
 */
@Mapper
public interface CoachMapper extends BaseMapper<Coach> {

    /**
     * 机构端查询教练分页 数据较多
     *
     * @param page 分页参数
     * @param dto  入参
     * @return PageOrganizationCoachVO
     */
    IPage<PageOrganizationCoachVO> organizationPage(@Param("page") Page<PageOrganizationCoachVO> page,
                                                    @Param("dto") PageOrganizationCoachDTO dto);

    /**
     * 获取教练服务信息
     *
     * @param courseId            课程id
     * @param campusId            校区id
     * @param scheduleTemplateIds 排班表id
     * @return List<CoachServeVO>
     */
    List<CoachServeVO> serveInfo(@Param("courseId") String courseId, @Param("campusId") String campusId, @Param("ids") List<String> scheduleTemplateIds, @Param("statusList") List<String> statusList);


    /**
     * 运营端端查询教练分页
     *
     * @param page 分页参数
     * @param dto  入参
     * @return PageOperationCoachVO
     */
    @DataPermission(alias = "c")
    IPage<PageOperationCoachVO> operationPage(@Param("page") Page<PageOperationCoachVO> page,
                                              @Param("dto") PageOperationCoachDTO dto);

    /**
     * 获取教练的openId
     *
     * @param coachId 教练id
     * @return openId
     */
    String getOpenIdByCoachId(@Param("coachId") String coachId);

    /**
     * function: 获取教练的WxUser
     *
     * @param coachId 教练id
     * @return WxUser
     * @author WangCX
     * @since 2022/8/11 15:46
     */
    WxUser getWxUserByCoachId(@Param("coachId") String coachId);

    /**
     * function:
     *
     * @param coachId   教练id
     * @param campusIds 校区ids
     * @return 是否有 1 有 0 无
     * @author WangCX
     * @since 2022/8/12 21:34
     */
    Integer whetherExceedSubRatio(@Param("coachId") String coachId, @Param("campusIds") List<String> campusIds);
}
